package org.jsola.hr.provider.impl;

import org.jsola.admin.entity.GregorianCalendarDO;
import org.jsola.admin.query.GregorianCalendarQuery;
import org.jsola.admin.service.IGregorianCalendarService;
import org.jsola.hr.provider.IGregorianCalendarProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author wu
 */
@Service("hrGregorianCalendarProviderService")
public class GregorianCalendarProviderServiceImpl implements IGregorianCalendarProviderService {

    @Autowired
    private IGregorianCalendarService gregorianCalendarService;


    @Override
    public List<GregorianCalendarDO> selectClendar(GregorianCalendarQuery gregorianCalendarQuery, String siteId) {
        List<GregorianCalendarDO> gregorianCalendarDOList = gregorianCalendarService.selectClendar(gregorianCalendarQuery, siteId);
        if (CollectionUtils.isEmpty(gregorianCalendarDOList)) {
            // 查询默认站点的
            gregorianCalendarDOList = gregorianCalendarService.selectClendar(gregorianCalendarQuery, "default");
        }
        return gregorianCalendarDOList;
    }
}
